﻿<UserControl
    x:Class="WinRTXamlToolkit.Sample.Views.ItemsControlExtensionsTestView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Extensions="using:WinRTXamlToolkit.Controls.Extensions"
    mc:Ignorable="d">
    <UserControl.Resources>
        <DataTemplate
            x:Key="ItemTemplate">
            <Border
                Height="80"
                Width="100"
                Margin="1"
                BorderThickness="2"
                BorderBrush="Black"
                HorizontalAlignment="Left">
                <TextBlock
                    Text="{Binding}"
                    Margin="20,0,20,0"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    FontSize="48" />
            </Border>
        </DataTemplate>
        <Style
            x:Key="PanelStyle"
            TargetType="Panel">
            <Setter
                Property="Margin"
                Value="70,0" />
            <Setter
                Property="Background"
                Value="Orange" />
        </Style>
        <Style
            x:Key="LabelBorderStyle"
            TargetType="Border">
            <Setter
                Property="HorizontalAlignment"
                Value="Stretch" />
            <Setter
                Property="Background"
                Value="LightSkyBlue" />
            <Setter
                Property="Padding"
                Value="20,0,20,20" />
        </Style>

    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition
                Height="Auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition
                Width="Auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <TextBlock
            Text="First Visible Item"
            HorizontalAlignment="Right"
            Style="{StaticResource SubheaderTextStyle}" />
        <TextBlock
            Text="ItemsControl"
            Grid.Row="1"
            HorizontalAlignment="Right"
            Style="{StaticResource SubheaderTextStyle}" />

        <ContentControl
            x:Name="FirstVisibleItemControl"
            Grid.Column="1"
            Margin="70,0"
            Padding="3"
            ContentTemplate="{StaticResource ItemTemplate}" />

        <FlipView
            x:Name="ItemsControlSelector"
            Grid.Row="1"
            Grid.Column="1"
            SelectionChanged="OnFlipViewSelectionChanged">
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="ItemsControl"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <ItemsControl
                    x:Name="ItemsControl"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}" />
            </controls:DockPanel>
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="ListBox"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <ListBox
                    x:Name="ListBox"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}" />
            </controls:DockPanel>
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="ListView"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <ListView
                    x:Name="ListView"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}" />
            </controls:DockPanel>
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="ListView with ItemsPanel=StackPanel"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <ListView
                    x:Name="ListViewWithStackPanelAsItemsPanel"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel />
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>
            </controls:DockPanel>
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="ListView with ItemsPanel=VirtualizingStackPanel"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <ListView
                    x:Name="ListViewWithVirtualizingStackPanelAsItemsPanel"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}">
                    <ListView.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ListView.ItemsPanel>
                </ListView>
            </controls:DockPanel>
            <controls:DockPanel
                Style="{StaticResource PanelStyle}">
                <Border
                    controls:DockPanel.Dock="Top"
                    Style="{StaticResource LabelBorderStyle}">
                    <TextBlock
                        Text="GridView"
                        Style="{StaticResource SubheaderTextStyle}" />
                </Border>
                <GridView
                    x:Name="GridView"
                    Loaded="OnItemsControlLoaded"
                    ItemTemplate="{StaticResource ItemTemplate}" />
            </controls:DockPanel>
        </FlipView>
    </Grid>
</UserControl>
